import { useDictStore } from '@/store';
import { getLabel } from '@/utils/';

export default function useGetLabel(dictKey: string, value: any) {
  if (!dictKey || value === undefined || value === null) return '';
  const dictStore = useDictStore();

  if (!dictStore.dictMap[dictKey]) return value;
  const dictDesc = getLabel(value, dictStore.dictMap[dictKey]);

  return dictDesc;
}
